import request from "@/utils/request";
import type {  FroUser } from '@/api/front/user/type'
enum API {
    LOGIN_URL = "/auth/front/login",
    USER_INFO_BY_LOGIN = "/front/user/by/login",
    LOGOUT="/auth/front/logout",
    USER_ENROLL="/auth/front/enroll",
    USER="/front/user",
    USER_INFO="/front/user/info/by-login",
    MODIFY_USER="/front/user/by/login-user",
    USER_FOLLOW="/front/user/follow",
}


export function reqLogin(data: any) {
    return request<string>({
        url: API.LOGIN_URL,
        method: 'post',
        data
    })
}
export function reqModifyLoginUser(data: any) {
    return request<string>({
        url: API.MODIFY_USER,
        method: 'PUT',
        data
    })
}

export function reqGetLoginUser() {
    return request<FroUser>({
        url: API.USER_INFO_BY_LOGIN,
        method: 'GET',
    })
}
export function reqGetLoginUserInfo(){
    return request<FroUser>({
        url: API.USER_INFO,
        method: 'GET',
    })
}
export function reqGetUserById(userId) {
    return request<FroUser>({
        url: API.USER+"/"+userId,
        method: 'GET',
    })
}
export function reqLogout() {
    return request({
        url: API.LOGOUT,
        method: 'POST',
    })
}
export function reqEnrollUser(data: any) {
    return request<string>({
        url: API.USER_ENROLL,
        method: 'post',
        data
    })
}
export function reqUserFollow(data: any) {
    return request<string>({
        url: API.USER_FOLLOW,
        method: 'post',
        data
    })
}
